const { getShopsBystate, deleteShopsById, addShops, getShops,updateShopsById, searchApplys ,shopsDeleteApply,updateApplyById,deleteApplysById} = require('../dao/shopsDao.js')

module.exports.deleteShopsById = async ShopsId => {
    const result = await deleteShopsById(ShopsId);
    if (result.ok === 1) {
        return true;
    }
    return false;
}
module.exports.searchApplys = async applys => await searchApplys(applys);

module.exports.addShops = async newShops => {
    const result = await addShops(newShops);
    if (result._id) {
        return result;
    }
    return false;
}
module.exports.getShops = async _id => {
    const result = await getShops(_id);
    if (result.length > 0) {
        return result;
    }
    return false;
}
module.exports.getShopsBystate = async _id => {
    const result = await getShopsBystate(_id);
    if (result.length > 0) {
        return result;
    }
    return false;
}
module.exports.updateShopsById = async Shops => {
    const result = await updateShopsById(Shops);
    console.log(result,1111);
    
    if (result.ok === 1) {
        return result;
    }
    return false;
}



module.exports.shopsDeleteApply = async applysStatus => {
    const result = await shopsDeleteApply(applysStatus);
    if (result.ok === 1) {
        return true;
    }
    return false;
}

//驳回修改状态为status:3； 同意修改状态为status:2
module.exports.updateApplyById = async msg => {
    const result = await updateApplyById(msg);
    if (result.ok === 1) {
        return true;
    }
    return false;
}

module.exports.deleteApplysById = async applysId => {
    const result = await deleteApplysById(applysId);
    console.log(result)
    if (result.ok === 1) {
        return true;
    }
    return false;
}